package org.awa.demo.opencv.bean;

import lombok.Builder;
import lombok.Data;
import org.awa.demo.opencv.gltf.SoundUtil;
import org.locationtech.jts.math.Vector3D;

@Data
public class NoiseSource {

    private double lw;
    private double _4R;
    private int Q;
    private double R;
    private Vector3D location;

    @Builder
    public NoiseSource(int Q, double R,Vector3D location) {
        this.Q = Q;
        this.R = R;
        this.location = location;
    }

    public NoiseSource calLw(double lp, Vector3D measureLocation) {
        Double distance = SoundUtil.getDistance(location, measureLocation);
        this.lw = lp + 20 * Math.log10(distance) + 8;

        this._4R = 4 / this.R;
        return this;
    }

    public double get4R(){
        return this._4R;
    }

}
